[_]: feat/enhance email address validation and availability checks#77
Conversation
jzunigax2
commented
Jul 18, 2026
- Updated email address validation logic to include availability checks against the backend.
- Introduced new rules for email address format validation and improved user feedback for taken addresses.
- Enhanced the UI to reflect the loading state during availability checks and updated button states accordingly.
- Added localization support for new validation messages in multiple languages.
- Refactored related tests to cover new functionality and ensure robust validation behavior.
- Updated email address validation logic to include availability checks against the backend. - Introduced new rules for email address format validation and improved user feedback for taken addresses. - Enhanced the UI to reflect the loading state during availability checks and updated button states accordingly. - Added localization support for new validation messages in multiple languages. - Refactored related tests to cover new functionality and ensure robust validation behavior.
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChangesEmail setup now validates username format and backend availability, handles unavailable or uncertain addresses during submission, supports suggestion-specific labels, and adds localized messages and tests across the service, validation hook, UI, and rule logic. Email availability flow
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/features/identity-setup/hooks/emailAddressRules.test.ts`:
- Line 242: Rewrite the changed test descriptions using plain-language “When …,
then …” behavior statements, without naming implementation symbols. In
src/features/identity-setup/hooks/emailAddressRules.test.ts lines 242-242,
replace the isEmailAddressFormatValid suite description; in
src/features/identity-setup/hooks/useEmailAddressValidation.test.ts lines
30-188, remove hook and callback names from the affected suite and test
descriptions while preserving their behavioral meaning.
- Around line 243-252: Update the affected tests around
isEmailAddressFormatValid to follow the AAA pattern: assign each input during
Arrange, call isEmailAddressFormatValid in a separate Act statement, then assert
the stored result. Add blank lines between the Arrange, Act, and Assert sections
while preserving the existing inputs and expected outcomes.
In `@src/features/identity-setup/hooks/useEmailAddressValidation.test.ts`:
- Line 30: Update the test descriptions within the useEmailAddressValidation
suite to use “When …, then …” wording focused on user-observable situations and
outcomes. Remove references to implementation names such as the hook,
validateAddress, and checkAvailability while preserving each test’s existing
behavior and assertions.
- Around line 161-175: Add a deferred-request test for checkAvailability that
starts with one username/domain, changes the current input before the
availability promise resolves, then resolves the old request successfully and
asserts its result cannot set canSubmit to true or authorize submission. Cover
the stale-result path in useEmailAddressValidation and include the rejection
behavior if the existing test utilities support it.
- Around line 31-39: Update the test setup around beforeEach and afterEach to
call vi.restoreAllMocks() at the start of beforeEach before configuring
checkAddressAvailability.mockResolvedValue. Remove the vi.clearAllMocks() call
from afterEach while preserving fake-timer setup and restoration.
In `@src/features/identity-setup/hooks/useEmailAddressValidation.ts`:
- Around line 56-65: Update checkAvailability in useEmailAddressValidation so
requests are invalidated immediately when the username or domain changes, and
ensure a request whose requestId no longer matches latestRequestIdRef.current
returns a non-success availability state instead of its stale result. Keep
lastCheck updates restricted to the current request, and preserve the existing
valid-result behavior when the request remains current.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8e165380-9d77-4953-9e6e-e1000e9d99dd
📒 Files selected for processing (13)
src/features/identity-setup/components/EmailAddressRulesPanel.tsxsrc/features/identity-setup/components/UpdateEmail.tsxsrc/features/identity-setup/hooks/emailAddressRules.test.tssrc/features/identity-setup/hooks/emailAddressRules.tssrc/features/identity-setup/hooks/useEmailAddressValidation.test.tssrc/features/identity-setup/hooks/useEmailAddressValidation.tssrc/features/identity-setup/hooks/useUpdateEmail.tssrc/i18n/locales/en.jsonsrc/i18n/locales/es.jsonsrc/i18n/locales/fr.jsonsrc/i18n/locales/it.jsonsrc/services/sdk/mail/index.tssrc/services/sdk/mail/mail.service.test.ts
Deploying mail-web with
|
| Latest commit: |
d4498fd
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1d303d3d.mail-web-ea0.pages.dev |
| Branch Preview URL: | https://feat-add-taken-address-check.mail-web-ea0.pages.dev |
|

